app.controller('advancePlayListCtrl', function($element, $scope, $state, rest, user,uploadConf,tipService) {
	var data = angular.copy($scope.ngDialogData, {});

	$scope.params = {};

	$scope.dataTableSettings = {
        "sAjaxSource": "J023",
        "aoColumns": [
            {
                "mDataProp": "originalId",
                "sTitle": "合同ID",
                "sDefaultContent": "",
                "sClass": "center"
            }, {
                "mDataProp": "fromTo",
                "sTitle": "租管系统固定值为zg",
                "sDefaultContent": "",
                "sClass": "center"
            }, {
                "mDataProp": "planAdvancePlayBeginDate",
                "sTitle": "计划垫付查询起始日期",
                "sDefaultContent": "",
                "sClass": "center"
            }, {
                "mDataProp": "planAdvancePlayEndDate",
                "sTitle": "计划垫付查询结束日期",
                "sDefaultContent": "",
                "sClass": "center"
            }, {
                "mDataProp": "planStatus",
                "sTitle": "垫付",
                "sDefaultContent": "",
                "sClass": "center"
            }
        ],
        "fnRowCallback": function(nRow, aData, iDisplayIndex) {
            var btnStr = "";

            var buttons = getButtons(aData);

            var btnStr = buttons.join("");            

            $(nRow).find(".handle-td").append($compile(btnStr)($scope));
            $(nRow).find(".handle-td").prev().empty().append(time(aData.createDate));

            tmpHouseIdArr += aData.houseId + ",";
            if (iDisplayIndex >= 9) {
                // console.log(tmpHouseIdArr);
            }
        },
        "fnDrawCallback": function(oSettings) {
            $scope.houseLoanStatusValue = $scope.queryParams.houseLoanStatus;
            if ("number" == typeof $scope.houseLoanStatusValue) {
                $scope.checkTypeArray.map(function(ele, index) {
                    if ($scope.houseLoanStatusValue == ele.value) {
                        $scope.houseLoanStatus.selected = ele;
                    }
                })
            }
        },
        "fnServerParams": function(aoData) {
            if($scope.houseLoanStatus && $scope.houseLoanStatus.selected){
                $scope.queryParams.houseLoanStatus = $scope.houseLoanStatus.selected.value
            }

            aoData.push({
                'name': 'queryParams',
                'value': $scope.queryParams
            });
            return aoData;
        }
    }

});